let arr = [1, 2]

let num = 0
arr.forEach(item => {
  num = item + num
})

console.log(num);